'''
#
# File: frame.py
# Description: JHB wxFrame object for main GUI
#
# Copyright 2012 Adam Meadows
#
#    Licensed under the Apache License, Version 2.0 (the "License");
#    you may not use this file except in compliance with the License.
#    You may obtain a copy of the License at
#
#        http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#
'''

import wx

class JhbFrame(wx.Frame):
    def __init__(self, *args, **kwargs):
        super(JhbFrame, self).__init__(*args, **kwargs)
        self.InitUI()

    def InitUI(self):
        menuBar = wx.MenuBar()

        fileMenu = wx.Menu()
        fileNew = fileMenu.Append(wx.ID_NEW, 'New\tCtrl+N')
        fileOpen = fileMenu.Append(wx.ID_OPEN, 'Open\tCtrl+O')
        fileSave = fileMenu.Append(wx.ID_SAVE, 'Save\tCtrl+S')
        menuBar.Append(fileMenu, 'File')

        self.Bind(wx.EVT_MENU, self.OnNew, fileNew)
        self.Bind(wx.EVT_MENU, self.OnOpen, fileOpen)
        self.Bind(wx.EVT_MENU, self.OnSave, fileSave)

        accountMenu = wx.Menu()
        accountsNew = accountMenu.Append(wx.ID_ANY, 'Create\tCtrl+R')
        accountsManage = accountMenu.Append(wx.ID_ANY, 'Manage\tCtrl+A')
        menuBar.Append(accountMenu, 'Accounts')

        self.Bind(wx.EVT_MENU, self.OnCreateAccount, accountsNew)
        self.Bind(wx.EVT_MENU, self.OnManageAccounts, accountsManage)

        self.SetMenuBar(menuBar)
        self.Centre()
        self.Show(True)

    def OnNew(self, e):
        # TODO: close current file and create a new one
        print 'OnNew'

    def OnOpen(self, e):
        # TODO: open a file
        print 'OnOpen'

    def OnSave(self, e):
        # TODO: save existing file
        print 'OnSave'

    def OnCreateAccount(self, e):
        # TODO: implement this
        print 'OnCreateAccount'

    def OnManageAccounts(self, e):
        # TODO: implement this
        print 'OnManageAccounts'

